#pragma once

#include <Windows.h>
#include <iostream>
#include <string>

using namespace std;

class serialport
{
public:
	serialport(void);
	serialport(string _port);
	virtual ~serialport(void);

	BOOL writeABuffer(void* lpBuf, DWORD dwToWrite);
	BOOL readABuffer(void* lpBuf, DWORD dwToRead);
private:
	HANDLE portCom;

	DWORD dwWritten;
	BOOL writeStatus;

	DWORD dwRead;
	BOOL fWaitingOnRead;
	BOOL readStatus;

	DCB dcb;

	BOOL opened;

	COMMTIMEOUTS timeouts;
};

